<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>选择所有</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        ul{
            width: 300px;
            margin: 0 auto;
        }
        li{
            list-style: none;
        }
    </style>
    <script src="min_jq/min.js"></script>
</head>
<body>
<ul>
    <li><label>
        <input type="checkbox">&nbsp;编程语言(点我选中所有)
    </label></li>
    <li><label>
        <input type="checkbox">&nbsp;python
    </label></li>
    <li><label>
        <input type="checkbox">&nbsp;c语言
    </label></li>
    <li><label>
        <input type="checkbox">&nbsp;c++语言
    </label></li>
    <li><label>
        <input type="checkbox">&nbsp;java
    </label></li>
    <li><label>
        <input type="checkbox">&nbsp;go
    </label></li>
    <li><label>
        <input type="checkbox">&nbsp;c#
    </label></li>
</ul>
    <script>
        $(function(){
            var $chk=$("li:nth-child(1)>label>input")
            var $items=$("li:not(li:nth-child(1))>label>input")
            $chk.on("click",function (){
            // 全部选中
            if ($(this).prop("checked"))
            $items.each(function (index,element){
                $(element).prop("checked",true);
            })
            // 全部选中取消
            else{
                $items.each(function (index,element){
                $(element).prop("checked",false);
            })
            }
        })
        })
        $("li:odd").css({"background-color":"#ccc","padding":"5px 0"})
        $("li:even").css({"background-color":"rgba(157,154,154,0.8)","padding":"5px 0"})
        $("li").each(function (index,element){
            console.log($(element).text())
        })
    </script>
</body>
</html>